//从shop.js中导入数据
import shop from "../../api/shop";
//存储英雄皮肤数据
const state={
    list:[]
}

const getters={
    //搜索功能
    search:state=>{
        return state.list.filter(list=>list.title == state.title)
    }
}

//获取商品列表数据
const actions={
    getList({commit}){
        shop.getHerosList(data=>{
            commit('setList',data)
        })
    }
}
//将商品列表保存到state中
const mutations = {
    setList(state,data){
        state.list = data
    },
    search(state,title){
        state.title = title
    }
}
export default{
    namespaced:true,
    state,
    getters,
    actions,
    mutations
}